package com.java.huxb.backend.hall.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.java.huxb.backend.hall.controller.vo.HallSavedReqVO;
import com.java.huxb.backend.hall.controller.vo.HallsReqVO;
import com.java.huxb.backend.hall.controller.vo.HallsRespVO;
import com.java.huxb.backend.hall.service.HallsServiceAPI;
import com.java.huxb.backend.utils.vo.BaseResponseVO;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author huxb
 * @date 2020/1/30 0030 上午 9:24
 */
@RestController
@RequestMapping("/halls")
public class HallsController {

    @Autowired
    private HallsServiceAPI hallsServiceAPI;

    /**
     * 分页查询
     * @param hallsReqVO
     * @return
     */
    @RequestMapping("/list")
    public BaseResponseVO findValidPage(HallsReqVO hallsReqVO) {
        IPage<HallsRespVO> page = hallsServiceAPI.findValidPage(hallsReqVO);
        return BaseResponseVO.success(page);
    }

    /**
     * 新增
     * @param hallSavedReqVO
     * @return
     */
    @RequestMapping("/add")
    public BaseResponseVO add (HallSavedReqVO hallSavedReqVO) {
        hallsServiceAPI.addHall(hallSavedReqVO);
        return  BaseResponseVO.success();
    }

    @RequestMapping("/film/{filmId}")
    public BaseResponseVO findFilm(@PathVariable("filmId") String filmId) {

        Object obj = hallsServiceAPI.findFilmDetailById(filmId);
        BaseResponseVO filmDetailByIdWithFeign = hallsServiceAPI.findFilmDetailByIdWithFeign(filmId);

        String s = hallsServiceAPI.feignTest();
        return BaseResponseVO.success(s);
    }
}
